﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LIMS.BLL
{
    public class MessageManager
    {
        private static IDAL.IMessage message = DALFactory.DataAccessFactory<IDAL.IMessage>.CreateMessage();

        public static Boolean AddMeeage(Model.Messages mes)
        {
            return message.Add(mes);
        }

        public static Boolean DelMessage(Model.Messages mes)
        {
            return message.Remove(mes);
        }

        public static List<LIMS.Model.Messages> SearchMessage(String strMesStatus)
        {
            if (!String.IsNullOrEmpty(strMesStatus))
            {
                if (strMesStatus != "-1")
                {
                    return message.FindByStatus(strMesStatus);
                }
                return message.FindAll();
            }
            return message.FindAll();
        }

        public static Boolean ReplyMessage(LIMS.Model.Messages mes)
        {
            return message.UpdateByReply(mes);
        }

        public static string GetStuNameByMesID(String mesID)
        {
            return message.FindStuNameByID(mesID);
        }

        public static LIMS.Model.Messages GetMessageByID(String mesID)
        {
            return message.FindByID(mesID);
        }
    }
}
